#include<iostream>
#include<string>
using namespace std;
typedef long long LL;
const int N = 1e5 + 10;
int arr[N];
LL tr11[N], tr2[N];
int n, m;
int lowbit(int x)
{
	return x & -x;
}

void add(LL tr[], int x, LL v)
{
	for (int i = x; i <= n; i += lowbit(i)) {
		tr[i] += v;
	}
}
LL sum(LL tr[], int x)
{
	LL ans = 0;
	for (int i = x; i; i -= lowbit(i)) {
		ans += tr[i];
	}
	return ans;
}

LL get_sum(int x)
{
	return (x + 1) * sum(tr11, x) -  sum(tr2, x);
}
int main()
{
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> arr[i];
		int d = arr[i] - arr[i - 1];
		add(tr11, i, d);
		add(tr2, i, (LL)d * i);	
	}
	while (m--) {
		string op;
		cin >> op;
		int l, r, x;
		cin >> l >> r;
		if (op[0] == 'C') {
			cin >> x;
			add(tr11, l, x);
			add(tr11, r + 1, -x);
			add(tr2, l, l * x);
			add(tr2, r + 1, (r + 1) * (-x));
		}
		else {
			cout << get_sum(r) - get_sum(l - 1) << endl;
		}
	}
	return 0;
}